#pragma once

#include <QMap>
#include "qtbox2dabstractitem.h"
#include <QPolygonF>

class QtBox2DCollideItem;

class QtBox2DPolygonItem : public QtBox2DAbstractItem
{
	Q_OBJECT
private:
	QtBox2DPolygonItem():QtBox2DAbstractItem(0){};
public:
	QtBox2DPolygonItem(QtBox2DScene* scene);
	QtBox2DPolygonItem(QtBox2DScene* scene , int nPolygon);
	virtual ~QtBox2DPolygonItem(void);

	virtual void createPropertyWidget();
	virtual void createControllPoints();
	virtual void resetControllPoints();
	virtual QRectF boundingRect() const;
	virtual void createBody();
	virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

signals:
public slots:
	virtual void save(QDataStream &dataStream);
	virtual void load(QDataStream &dataStream);

	virtual void setProperty(QtProperty *prop, const QVariant &value);
	void pointsMove(QtBox2DCollideItem* item,QtProperty* prop);
private:
	QMap<QtProperty* ,QPointF> mPoints;
	QPolygonF                  mPolygon;
	int                        mPolygonNum;
};
